Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fragment value instead of search query for filters #907

Merged
merged 1 commit into from
Mar 15, 2023
Merged

Conversation

juuz0
Copy link
Collaborator

@juuz0 juuz0 commented Mar 6, 2023

Fixes #565

@juuz0 juuz0 requested a review from kelson42 March 6, 2023 21:42
@juuz0
Copy link
Collaborator Author

juuz0 commented Mar 6, 2023

I also changed some indentation to match rest of the document

@codecov
Copy link

codecov bot commented Mar 6, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (782a25b) 72.11% compared to head (174dedd) 72.11%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #907   +/-   ##
=======================================
  Coverage   72.11%   72.11%           
=======================================
  Files          54       54           
  Lines        3766     3766           
  Branches     2100     2100           
=======================================
  Hits         2716     2716           
  Misses       1048     1048           
  Partials        2        2           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kelson42
Copy link
Collaborator

kelson42 commented Mar 6, 2023

@juuz0 A brother PR should be done in kiwix-tools to upgrade documentation.

@kelson42
Copy link
Collaborator

kelson42 commented Mar 7, 2023

@juuz0 Using the term "hash" is wrong (see https://stackoverflow.com/questions/2800187/what-is-it-when-a-link-has-a-pound-sign-in-it#2800195) and actually misleading (because in programming "hash" refers to hashing algoritms).

Current naming is IMO appropriate and we can keep it even if we move the parameters after the pound character.

@juuz0
Copy link
Collaborator Author

juuz0 commented Mar 7, 2023

@kelson42 Thanks, fragment seems a much better name (another resource suggesting its use: https://www.rfc-editor.org/rfc/rfc3986#section-4.2)

I am not sure what you mean by
Current naming is IMO appropriate and we can keep it even if we move the parameters after the pound character.

Do you mean keeping class name as URLSearchParams? It could work but that's a built-in JS interface. We probably shouldn't be naming it same - may use search queries in future where URLSearchParams is needed.

Alternative name could be FragmentParams

@juuz0
Copy link
Collaborator Author

juuz0 commented Mar 7, 2023

A brother PR should be done in kiwix-tools to upgrade documentation

I looked through https://github.com/kiwix/kiwix-tools/blob/main/docs/kiwix-serve.rst
Seems like it doesn't really need any modifications. It doesn't talk about filtering on welcome page (the only target of this PR)

static/skin/index.js Outdated Show resolved Hide resolved
static/skin/index.js Outdated Show resolved Hide resolved
static/skin/index.js Outdated Show resolved Hide resolved
static/skin/i18n/en.json Show resolved Hide resolved
static/skin/index.js Outdated Show resolved Hide resolved
@mgautierfr mgautierfr changed the title Use hash value instead of search query for filters Use fragment value instead of search query for filters Mar 7, 2023
@juuz0 juuz0 force-pushed the hash branch 2 times, most recently from 922c455 to d707d1a Compare March 9, 2023 09:50
@juuz0
Copy link
Collaborator Author

juuz0 commented Mar 9, 2023

I changed FragmentParams to extend URLSearchParams instead of Map - this way I dont need to reinvent the URL encoding stuff in FragmentParams

The filters are now taken from window.location.hash (instead of window.location.search).
This change will help in caching of the page better.
@mgautierfr mgautierfr merged commit 6b57ad8 into main Mar 15, 2023
@mgautierfr mgautierfr deleted the hash branch March 15, 2023 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SERVER] Do not use query to convey the filters of the main page.
4 participants